#define _CRT_SECURE_NO_WARNINGS 1
double funpi(double e)
{
	double flag = 1, sum = 0;
	for (int i = 1;; i++)
	{
		double t = flag / (2 * i - 1);
		if (t < 0)
		{
			if (-t < e)
				break;
		}
		else
		{
			if (t < e)
				break;
		}
		sum += t;  //求和
		flag = -flag;  //正负反转
	}
	return sum;
}